package cn.jingyinghui.service;

import cn.jingyinghui.rules.customer.User;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RuleService {

    @Autowired
    private KieContainer kieContainer;

    public User applyRules(User user) {
        KieSession kieSession = kieContainer.newKieSession();
        kieSession.insert(user);
        kieSession.fireAllRules();
        kieSession.dispose();
        return user;
    }
}
